
/**
 * information vuex
 */
import posts from '@/plugins/request'
import storage from '@/plugins/localStorage'

// initial state
const state = {
  technicalList: [],
  lawsRegulation: {
    data: [],
    total: 0
  }
}
// getters
const getters = {
  getTechnicalList: state => state.technicalList,
  getLawsRegulation: state => state.lawsRegulation,
}
// actions
const actions = {
  async fetchTechnicalList({ commit }, keyword) {
    let data = await posts.fetchTechnicalList(keyword)
    commit('changeTechnicalList', data)
  },
  async fetchLawsRegulaList({ commit }, param) {
    let data = await posts.fetchLawsRegulaList(param)
    commit('changeLawsRegulaList', data)
  },
  
}

// mutations
const mutations = {
  changeTechnicalList(state, data) {
    state.technicalList = data
  },
  changeLawsRegulaList(state, data) {
    state.lawsRegulation.data = data.rows
    state.lawsRegulation.total = data.total
  },
}

export default {
  state,
  getters,
  actions,
  mutations
}
